<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RabbitMQ 完全指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
        }
        .serif-font {
            font-family: 'Noto Serif SC', serif;
        }
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            overflow-x: auto;
        }
        .code-block pre {
            margin: 0;
            padding: 1.5rem;
            font-family: 'Consolas', 'Monaco', monospace;
            font-size: 14px;
            line-height: 1.6;
        }
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            margin-top: -0.2rem;
            color: #667eea;
        }
        .section-divider {
            height: 2px;
            background: linear-gradient(to right, transparent, #e5e7eb, transparent);
            margin: 3rem 0;
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-24 px-6">
        <div class="max-w-6xl mx-auto text-center animate-fadeInUp">
            <h1 class="text-5xl md:text-6xl font-bold mb-6 serif-font">RabbitMQ 完全指南</h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">掌握消息队列技术，构建高性能分布式系统</p>
            <div class="flex justify-center space-x-8 text-lg">
                <div class="flex items-center">
                    <i class="fas fa-server mr-2"></i>
                    <span>企业级消息中间件</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-bolt mr-2"></i>
                    <span>高性能异步通信</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-code mr-2"></i>
                    <span>SpringBoot 集成</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-6xl mx-auto px-6 py-12">
        
        <!-- Introduction Section -->
        <section class="mb-16 animate-fadeInUp">
            <h2 class="text-4xl font-bold mb-8 gradient-text serif-font">为什么选择消息中间件？</h2>
            <div class="bg-white rounded-xl shadow-lg p-8">
                <p class="text-lg leading-relaxed mb-6">
                    <span class="drop-cap serif-font">在</span>现代分布式系统架构中，服务之间的通信变得越来越复杂。传统的同步调用方式存在诸多问题：系统耦合度高、性能瓶颈明显、可靠性差。消息中间件技术应运而生，它通过异步消息传递机制，实现了系统间的解耦，提高了整体性能和可靠性。
                </p>
                
                <!-- Architecture Diagram -->
                <div class="my-12">
                    <div class="mermaid">
                        graph LR
                            A[生产者] -->|发送消息| B[消息队列]
                            B -->|消费消息| C[消费者1]
                            B -->|消费消息| D[消费者2]
                            B -->|消费消息| E[消费者3]
                            
                            style A fill:#667eea,stroke:#fff,stroke-width:2px,color:#fff
                            style B fill:#764ba2,stroke:#fff,stroke-width:2px,color:#fff
                            style C fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                            style D fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                            style E fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    </div>
                </div>

                <div class="grid md:grid-cols-3 gap-6 mt-8">
                    <div class="card-hover bg-gradient-to-br from-purple-50 to-pink-50 p-6 rounded-lg">
                        <i class="fas fa-unlink text-3xl text-purple-600 mb-4"></i>
                        <h3 class="text-xl font-semibold mb-2">系统解耦</h3>
                        <p class="text-gray-700">生产者和消费者无需直接通信，降低系统间依赖</p>
                    </div>
                    <div class="card-hover bg-gradient-to-br from-blue-50 to-indigo-50 p-6 rounded-lg">
                        <i class="fas fa-tachometer-alt text-3xl text-blue-600 mb-4"></i>
                        <h3 class="text-xl font-semibold mb-2">异步处理</h3>
                        <p class="text-gray-700">提高系统响应速度，优化用户体验</p>
                    </div>
                    <div class="card-hover bg-gradient-to-br from-green-50 to-teal-50 p-6 rounded-lg">
                        <i class="fas fa-shield-alt text-3xl text-green-600 mb-4"></i>
                        <h3 class="text-xl font-semibold mb-2">削峰填谷</h3>
                        <p class="text-gray-700">应对流量高峰，保护系统稳定性</p>
                    </div>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- RabbitMQ Overview -->
        <section class="mb-16 animate-fadeInUp">
            <h2 class="text-4xl font-bold mb-8 gradient-text serif-font">认识 RabbitMQ</h2>
            <div class="bg-white rounded-xl shadow-lg p-8">
                <div class="grid md:grid-cols-2 gap-8 items-center">
                    <div>
                        <p class="text-lg leading-relaxed mb-6">
                            RabbitMQ 是一个基于 AMQP（高级消息队列协议）的开源消息代理软件，使用 Erlang 语言开发，具有高可用、高性能、可扩展等特点。它支持多种消息模式，能够满足不同场景的需求。
                        </p>
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                                <span><strong>可靠性保证：</strong>支持消息持久化、传输确认、发布确认等机制</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                                <span><strong>灵活路由：</strong>通过 Exchange 和 Binding 实现灵活的消息路由</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                                <span><strong>集群支持：</strong>支持集群部署，提供高可用性</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                                <span><strong>管理界面：</strong>提供友好的 Web 管理界面</span>
                            </li>
                        </ul>
                    </div>
                    <div class="bg-gradient-to-br from-gray-100 to-gray-200 p-8 rounded-lg">
                        <h3 class="text-2xl font-semibold mb-4 text-center">核心概念</h3>
                        <div class="mermaid">
                            graph TD
                                A[Producer 生产者] -->|发送| B[Exchange 交换机]
                                B -->|路由| C[Queue 队列]
                                C -->|消费| D[Consumer 消费者]
                                B -.->|Binding| C
                                
                                style A fill:#4a5568,stroke:#fff,stroke-width:2px,color:#fff
                                style B fill:#667eea,stroke:#fff,stroke-width:2px,color:#fff
                                style C fill:#764ba2,stroke:#fff,stroke-width:2px,color:#fff
                                style D fill:#4a5568,stroke:#fff,stroke-width:2px,color:#fff
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Installation Guide -->
        <section class="mb-16 animate-fadeInUp">
            <h2 class="text-4xl font-bold mb-8 gradient-text serif-font">快速安装部署</h2>
            <div class="bg-white rounded-xl shadow-lg p-8">
                <div class="mb-8">
                    <h3 class="text-2xl font-semibold mb-4 flex items-center">
                        <i class="fab fa-docker text-blue-500 mr-3"></i>
                        使用 Docker 安装
                    </h3>
                    <p class="text-gray-700 mb-4">推荐使用 Docker 进行安装，简单快捷，包含管理界面：</p>
                    <div class="code-block">
                        <pre>docker run -d --name myrabbitmq \
  -p 15672:15672 \
  -p 5672:5672 \
  rabbitmq:3.7.17-management</pre>
                    </div>
                    <div class="mt-4 grid md:grid-cols-2 gap-4">
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <p class="font-semibold text-blue-800">管理界面端口</p>
                            <p class="text-blue-600">15672 - Web 管理控制台</p>
                        </div>
                        <div class="bg-green-50 p-4 rounded-lg">
                            <p class="font-semibold text-green-800">服务端口</p>
                            <p class="text-green-600">5672 - AMQP 协议端口</p>
                        </div>
                    </div>
                </div>
                
                <div class="bg-gray-50 p-6 rounded-lg">
                    <p class="text-gray-700">
                        <i class="fas fa-info-circle text-blue-500 mr-2"></i>
                        安装完成后，访问 <code class="bg-gray-200 px-2 py-1 rounded">http://localhost:15672</code>，
                        使用默认账号 <code class="bg-gray-200 px-2 py-1 rounded">guest/guest</code> 登录管理界面。
                    </p>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Working Modes -->
        <section class="mb-16 animate-fadeInUp">
            <h2 class="text-4xl font-bold mb-8 gradient-text serif-font">工作模式详解</h2>
            
            <!-- Simple Mode -->
            <div class="bg-white rounded-xl shadow-lg p-8 mb-8 card-hover">
                <h3 class="text-2xl font-semibold mb-4 flex items-center">
                    <i class="fas fa-arrow-right text-purple-500 mr-3"></i>
                    简单模式（Simple Queue）
                </h3>
                <p class="text-gray-700 mb-6">最基础的工作模式，一个生产者对应一个消费者，适用于简单的任务分发场景。</p>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold mb-2">生产者代码示例</h4>
                        <div class="code-block text-sm">
                            <pre>// 创建连接
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();

// 声明队列
channel.queueDeclare("myqueue", false, false, false, null);

// 发送消息
String message = "Hello Rabbit